# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.


# What ports/sockets to listen on, and what options for them.
<%- @listen.each do |port, options| %>
listen "<%= port %>", <%= options %>
<%- end %>

<%- if @working_directory %>
working_directory '<%= @working_directory %>'
<%- end %>

# What the timeout for killing busy workers is, in seconds
timeout <%= @worker_timeout %>

# Whether the app should be pre-loaded
preload_app <%= @preload_app %>

# How many worker processes
worker_processes <%= @worker_processes %>

<%- if @before_fork %>
# What to do before we fork a worker
before_fork do |server, worker|
  <%= @before_fork %>
end

<%- end %>
<%- if @after_fork %>
# What to do after we fork a worker
after_fork do |server, worker|
  <%= @after_fork %>
end

<%- end %>
<%- if @pid %>
# Where to drop a pidfile
pid '<%= @pid %>'

<%- end %>
<%- if @stderr_path %>
# Where stderr gets logged
stderr_path '<%= @stderr_path %>'

<%- end %>
<%- if @stdout_path %>
# Where stdout gets logged
stdout_path '<%= @stdout_path %>'

<%- end %>
<%- if @relative_url %>
# Relative url from where GitLab is served
ENV['RAILS_RELATIVE_URL_ROOT'] = "<%= @relative_url %>"

<%- end %>
<%- if @worker_memory_limit_min %>
# Min memory size (RSS) per worker
ENV['GITLAB_UNICORN_MEMORY_MIN'] = (<%= @worker_memory_limit_min %>).to_s

<%- end %>
<%- if @worker_memory_limit_max %>
# Max memory size (RSS) per worker
ENV['GITLAB_UNICORN_MEMORY_MAX'] = (<%= @worker_memory_limit_max %>).to_s

<%- end %>
